使用Vue CLI 3 的 vue create 创建vue+ts 项目,使用默认配置, 控制台报警告Calls to 'console.log' are not allowed,解决

在tsling.json中的rules下 添加: "no-console": false。无需向在tsling.config中添加"extends":"./tslint.config"。重启服务,搞定。

附tsling.json文件:

{
  "defaultSeverity": "warning",
  "extends": [
    "tslint:recommended"
  ],
  "linterOptions": {
    "exclude": [
      "node_modules/**"
    ]
  },
  "rules": {
    "quotemark": [true, "single"],
    "indent": [true, "spaces", 2],
    "interface-name": false,
    "ordered-imports": false,
    "object-literal-sort-keys": false,
    "no-consecutive-blank-lines": false,
    "max-line-length": [ false ],
    "no-console": false
  }
}

element
28 声望4 粉丝